package at.nebbl.openscotty;

/**
 *
 * @author alex.nebel
 */
public class Station implements Comparable{

    private String name;
    private String route;

    public Station(String name, String route){
        this.name = name;
        this.route = route;
    }

    public int compareTo(Object arg) {
        if(arg instanceof Station){
            Station other = (Station)arg;
            if(route.compareToIgnoreCase(other.route) == 0){
                return name.compareToIgnoreCase(other.name);
            }else{
                return route.compareToIgnoreCase(other.route);
            }
        }else{
            return 1;
        }
    }

    public boolean startsWith(String prefix){
        return name.startsWith(prefix);
    }

    @Override
    public String toString(){
        return name;
    }
}
